#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

int main()
{
	int m = 3;
	int n = 3;
	int arr1[6] = { 1,2,3,0,0,0 };
	int arr2[3] = { 2,5,6 };
	int src = m - 1;
	int dst = n - 1;
	int end = m + n - 1;

	while (src >= 0 && dst >= 0)
	{
		if (arr1[src] >= arr2[dst])
		{
			arr1[end] = arr1[src];
			src--;
			end--;
		}
		else
		{
			arr1[end] = arr2[dst];
			dst--;
			end--;
		}
	}
	int i = 0;
	for (i = 0; i < 6; i++)
	{
		printf("%d\n", arr1[i]);

	}

	return 0;
}